<!DOCTYPE html>
<!--
Copyright (c) 2013 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
<link rel="import" href="/tracing/ui/analysis/single_event_sub_view.html">

<dom-module id='tr-ui-a-single-instant-event-sub-view'>
  <template>
    <style>
    :host {
      display: block;
    }
    </style>
    <div id='content'></div>
  </template>
</dom-module>
<script>
'use strict';

Polymer({
  is: 'tr-ui-a-single-instant-event-sub-view',
  behaviors: [tr.ui.analysis.AnalysisSubView],

  created() {
    this.currentSelection_ = undefined;
  },

  set selection(selection) {
    Polymer.dom(this.$.content).textContent = '';
    const realView = document.createElement('tr-ui-a-single-event-sub-view');
    realView.setSelectionWithoutErrorChecks(selection);

    Polymer.dom(this.$.content).appendChild(realView);

    this.currentSelection_ = selection;
  },

  get selection() {
    return this.currentSelection_;
  }
});

tr.ui.analysis.AnalysisSubView.register(
    'tr-ui-a-single-instant-event-sub-view',
    tr.model.InstantEvent,
    {
      multi: false,
      title: 'Instant Event',
    });

tr.ui.analysis.AnalysisSubView.register(
    'tr-ui-a-multi-instant-event-sub-view',
    tr.model.InstantEvent,
    {
      multi: true,
      title: 'Instant Events',
    });

</script>
